<script setup>
import axios from 'axios'
import {ref} from 'vue'

let msg = ref("")

function getMsg(){
  // let promise = axios({
  //   method:"post",
  //   url:"https://api.uomg.com/api/rand.qinghua?format=json",
  //   data:{
  //     username:"zhangsan"
  //   }
  // })
  let promise = axios.get("https://api.uomg.com/api/rand.qinghua",{
    params:{
      format:'json',
      username:'zhangsan'
    }
  })

  promise.then(function(response){
    console.log(response)
    msg.value=response.data.content
  })
}

</script>

<template>
  <div>
    <h1>{{ msg }}</h1>
    <button @click="getMsg()">获取今日土味情话</button>
  </div>
</template>

<style scoped>
</style>
